package com.dl.base.ui.utils


import android.content.res.ColorStateList
import android.graphics.drawable.Drawable
import android.view.animation.Animation
import android.view.animation.AnimationUtils
import androidx.annotation.*
import androidx.appcompat.content.res.AppCompatResources
import androidx.core.content.ContextCompat
import com.dl.base.appContext

fun getResDrawable(@DrawableRes resId: Int): Drawable =
    AppCompatResources.getDrawable(appContext, resId)!!

fun getResString(@StringRes resId: Int): String = appContext.getString(resId)
fun getResColor(@ColorRes resId: Int): Int = ContextCompat.getColor(appContext, resId)
fun getResColorList(resId: Int): ColorStateList =
    AppCompatResources.getColorStateList(appContext, resId)

fun getResDime(@DimenRes resId: Int): Int = appContext.resources.getDimensionPixelSize(resId)
fun getResAnim(@AnimRes resId: Int): Animation? =
    AnimationUtils.loadAnimation(appContext, resId)